#include "SList.h"

void SListNodeText1()
{
	SListNode* plist = NULL;

	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);
	SListPushBack(&plist, 5);

	SListPopBack(&plist);
	SListPopBack(&plist);
	SListPopBack(&plist);
	SListPopBack(&plist);
	SListPopBack(&plist);


	SListPrint(plist);

}

void SListNodeText2()
{
	SListNode* plist = NULL;

	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);

	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);


	SListPrint(plist);

	SListNode* ret = SListFind(plist, 1);
	printf("%d\n", ret->data);

}

void SListNodeText3()
{
	SListNode* plist = NULL;

	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);

	//SListNode* pos = SListFind(plist, 5);
	//SListSinsert(&plist, pos, 10);

	SListNode* pos = SListFind(plist, 1);
	SListInsertAfter(pos, 10);

	pos = SListFind(plist, 5);
	SListInsertAfter(pos, 50);

	SListPrint(plist);

}

void SListNodeText4()
{
	SListNode* plist = NULL;

	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);


	//SListNode* pos = SListFind(plist, 1);
	//SListErase(&plist, pos);

	//pos = SListFind(plist, 5);
	//SListErase(&plist,pos);

	SListNode* pos = SListFind(plist, 2);
	SListEraseAfter(pos);

	pos = SListFind(plist, 4);
	SListEraseAfter(pos);

	SListPrint(plist);

	SListDestroy(&plist);

}
int main()
{
	SListNodeText4();
	return 0;
}